package com.boc.langxiang.presenter.me;

import android.support.v4.app.FragmentManager;

import com.boc.langxiang.contract.me.MyExerciseActivityContract;
import com.boc.langxiang.ui.adapter.me.MyExercisePagerAdapter;
import com.boc.langxiang.ui.fragment.BaseFragment;
import com.boc.langxiang.ui.fragment.me.MyExerciseJoinFragment;
import com.boc.langxiang.ui.fragment.me.MyExerciseWantFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by admin on 2016/6/27.
 */
public class MyExerciseActivityPresenter implements MyExerciseActivityContract.Presenter {

    private List<BaseFragment> mList;
    private MyExerciseActivityContract.View mView;

    private MyExercisePagerAdapter mAdapter;

    public MyExerciseActivityPresenter(MyExerciseActivityContract.View view) {
        this.mView = view;
    }


    public void initFragmentList() {

        if (mList == null) {
            mList = new ArrayList<>();
        }
        mList.clear();

        mList.add(MyExerciseWantFragment.getInstance());
        mList.add(MyExerciseJoinFragment.getInstance());
    }

    public void initAdapter(FragmentManager supportFragmentManager) {
        mAdapter = new MyExercisePagerAdapter(supportFragmentManager, mList);
        mView.setAdapter(mAdapter);
    }


}
